import com.pyg.mapper.TbSpecificationMapper;
import com.pyg.pojo.TbSpecification;
import com.pyg.pojo.TbSpecificationExample;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.util.List;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "classpath*:spring/applicationContext-dao.xml")
public class test {
    @Autowired
    private TbSpecificationMapper specificationMapper;
    /**
     * 需求：添加
     */
    @Test
    public void add() {
        //创建规格对象
        TbSpecification specification = new TbSpecification();
        specification.setSpecName("机身");

        specificationMapper.insertSelective(specification);

    }
    /**
     * 需求：查询所有
     */
    @Test
    public void selectByCondition1() {

        List<TbSpecification> list = specificationMapper.selectByExample(null);
        System.out.println(list);
    }
    /**
     * 需求：查询所有
     */
    @Test
    public void selectByCondition2(){
        TbSpecificationExample example = new TbSpecificationExample();
        TbSpecificationExample.Criteria criteria = example.createCriteria();

    }
}
